#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<vector>
#include<functional>

using namespace std;



#include"smart_ptr.h"



//class Node
//{
//public:
//	Node()
//		:next(nullptr)
//		,prev(nullptr)
//	{}
//
//
//	wjb::weak_ptr<Node> next;
//	wjb::weak_ptr<Node> prev;
//};
//
//
//
//int main()
//{
//
//	wjb::auto_ptr<int> ap(new int(4));
//	cout << *ap << endl;
//
//	/*wjb::unique_ptr<int> up1(new int(5));
//
//	wjb::unique_ptr<int> up2(up1);
//	wjb::unique_ptr<int> up3(new int (6));
//	up3 = up1;*/
//
//
//
//	//wjb::shared_ptr<pair<string, string>> sp1(new pair<string,string>("string", "string"));
//
//	//cout << sp1->first << " : " << sp1->second << endl;
//
//
//	//wjb::shared_ptr<pair<string, string>> sp2(sp1);
//
//	//wjb::shared_ptr<pair<string, string>> sp3(sp2);
//	//wjb::shared_ptr<pair<string, string>> sp4(new pair<string, string>("xxx", "yyyy"));
//
//	//sp4 = sp1;
//
//
//	wjb::shared_ptr<Node> sp1(new Node());
//	wjb::shared_ptr<Node> sp2(new Node());
//	sp1->next = sp2;
//	sp2->prev = sp1;
//
//
//	
//
//
//	return 0;
//}

double f(double x)
{
	return x / 5;
}


class fs
{
public:


	double operator()(double x)
	{
		return x / 4;
	}

};







//int sub(int x, int y,int rate)
//{
//	return rate * (x - y);
//}


int sub(int rate, int x, int y)
{
	return rate * (x - y);
}


int main()
{
	/*function<double(double)> fc1 = [](double x) {return x / 3; };
	function<double(double)> fc2 = f;
	function<double(double)> fc3 = fs();

	cout << fc1(10) << endl;
	cout << fc2(10) << endl;
	cout << fc3(10) << endl;




	vector<function<double(double)>> v = {
		[](double x) {return x / 3; }
		,f
		,fs()
	};


	for (auto f : v)
	{
		cout << f(10) << endl;
	}*/

	
	/*function<int(int, int)> b1 = bind(sub, placeholders::_1, placeholders::_2);
	function<int(int, int)> b2 = bind(sub, placeholders::_2, placeholders::_1);


	cout << b1(10,5) <<endl;


	cout << b2(10,5) <<endl;*/


	/*function<int(int, int)> b3 = bind(sub, placeholders::_1, placeholders::_2,3.5);
	function<int(int, int)> b4 = bind(sub, placeholders::_1, placeholders::_2, 4.0);


	cout << b3(10, 5) << endl;

	cout << b4(10, 5) << endl;*/


	function<int(int, int)> b5 = bind(sub, 6.0,placeholders::_1, placeholders::_2);
	function<int(int, int)> b6 = bind(sub, 5.0,placeholders::_1, placeholders::_2);


	cout << b5(10, 5) << endl;

	cout << b6(10, 5) << endl;

	return 0;
}